﻿using DevExpress.XtraGrid.Demos.util;
using Luna小店.DTO;
using mendian;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Luna小店.UC.项目成果管理.service
{
    public class 项目成果Service
    {
        /// <summary>
        /// 获取全部成果项目
        /// </summary>
        /// <returns></returns>
        public static List<wbsItemDTO> get全部项目(String wbsTemplateId)
        {
            DTO工序管理 DTO工序管理 = FunctionHelper.JsonDeserialization<DTO工序管理>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/project/findWBSTemplateDByIdAndSaveCache?wbsTemplateId=" + wbsTemplateId
                        )
                    );
            return DTO工序管理.wbsItemDTOList;


        }
        /// <summary>
        /// 点击左侧树
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public static wbsItemDTO get点击单个项目(String code)
        {
            return
                FunctionHelper.JsonDeserialization<wbsItemDTO>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/project/getWBSItemByCode?code=" + code
                        )
                    );
        }
        /// <summary>
        /// 项目成果管理，完成工作扫描员工信息
        /// </summary>
        public static void  post项目成果提交(DTO项目成果提交 DTO项目成果提交)
        {
            RestCall.PostHttp(
                    URL.接口url + "/project/saveProjectInstance?mnemonic=" + DTO项目成果提交.mnemonic
                        + "&styleId=" + DTO项目成果提交.styleId
                            + "&code=" + DTO项目成果提交.code,
                    DTO项目成果提交.content
                    );
        }

    }
    /// <summary>
    /// 项目成果管理，完成各自任务后扫描员工信息提交工作DTO
    /// </summary>
    public class DTO项目成果提交
    {
        public String mnemonic { get; set; }
        public String styleId { get; set; }
        public String code { get; set; }
        public String content { get; set; }
        public DTO项目成果提交()
        {

        }
    }

    public class DTO工序管理
    {
        public String id { get; set; }
        public String templateName { get; set; }
        public List<wbsItemDTO> wbsItemDTOList { get; set; } = new List<wbsItemDTO>();
        public DTO工序管理()
        {

        }

    }

    public class wbsItemDTO  //整个工序管理中的每个工序
    {
        public String id { get; set; }
        public String parentId { get; set; }
        public String activityDescription { get; set; }
        public String code { get; set; }
        public String index { get; set; }
        public List<achievementTemplateDTO> achievementTemplateDTOS { get; set; } = new List<achievementTemplateDTO>();
        public wbsItemDTO()
        {

        }

    }

    public class achievementTemplateDTO
    {

    }

}
